#pragma once
#include <allegro5/allegro.h>

const int NUMBER_OF_KEYBOARD_KEYS = ALLEGRO_KEY_MAX;

class Input
{
	public:
		Input();
		~Input();

		void ProceedEvent(ALLEGRO_EVENT ev);

		bool KeyPressed(int aKey);
		bool KeyDown(int aKey);
		bool KeyReleased(int aKey);

		bool MousePressed(int aKey);
		bool MouseDown(int aKey);
		bool MouseReleased(int aKey);
		int MouseDraggedX();
		int MouseDraggedY();
		int MouseScrolled();

		int GetMouseX();
		int GetMouseY();
		int GetMouseZ();

		void Tick();
	private:
		bool keysThisFrame[NUMBER_OF_KEYBOARD_KEYS];
		bool keysLastFrame[NUMBER_OF_KEYBOARD_KEYS];

		void InitJoystickMapping();

		int mJoyToKey[32];

		int allegroMouseCodes[3];
		ALLEGRO_MOUSE_STATE mouseStateThisFrame;
		ALLEGRO_MOUSE_STATE mouseStateLastFrame;
};

